<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>购票主页</title>
    <link rel="stylesheet" href="../css/main.css">
    <script type="text/javascript"src="../jquery-3.6.0.js"></script>
<!--    <script>-->
<!--        var movie_id;-->
<!--        $(function (){-->
<!--            $(".buyTicket").click(function (){-->
<!--                movie_id=$(this).attr('name');-->
<!--                alert(movie_id);-->
<!--                localStorage.setItem("movie_id",movie_id);-->
<!--            })-->
<!--        })-->
<!--    </script>-->
</head>
<body>
    <?php
        //获取数据集
        include_once("../service/MovieService.php");
    ?>
    <div>
        <?php
            $movieService=new MovieService();
            $movieInfo=$movieService->getAMovieInfo();
            $movieNum=$movieService->getMovieNum();
            for($i=0;$i<$movieNum;$i++) {
                echo "<div class='showMovie'>";
                echo "<img src=" . $movieInfo[$i]['picture_url'] . ">";
                echo "<a>".$movieInfo[$i]['movie_name']."</a>";
                echo "<br>";
                echo "主演:".$movieInfo[$i]['main_actor']."<br>"."导演:".$movieInfo[$i]['director'];
                echo "<br>";
//                echo $movieInfo[$i][movie_id];
                echo "<a href='choose_cinema.php?movie_id=".$movieInfo[$i]['movie_id']."'>".'<button>点击购票</button>'."</a>";
                echo "</div>";
            }
        ?>
<!--        <div class="showMovie">-->
<!--            <img src="../picture_url/1.jpg">-->
<!--            <a>上海堡垒</a>-->
<!--            <div class="info">主演:唐红军 票价:32 导演郭凡主演:唐红军主演:唐红军主演:唐红军</div>-->
<!--            <button >点击购票</button>-->
<!--        </div>-->
        <a href="mine_ticket.php" class="mine">我的</a>
    </div>
</body>
</html>